var pendingExamination = {
    skuAuditRecordIds: [],//审核集合
    skuAuditRecordDtos:[],//审核新集合
    modifyFlag: false,//是否点击修改标识
    customerId: '',//三级商品分类的入参
    secondCategoryList: [],//二级分类集合
    thirdCategoryList: [],//三级分类集合
    fourCategoryList: [],//四级分类
    skuIds: [],// sku审核记录ID集合
    checkFlag: false,// false 代表单条数据审核  true代表多条数据审核
    brandId:'',//品牌id
    categoryId: '',//分类ID
    classificationId: '',//归类ID
    revenueCode: '',// 税类编码
    timer: null,
    brandFlag:'',//品牌选择标识
    dataSource:[],//存储表格上的数据
    singleOrMultipleFlag:false,//多数据和但数据操作标识 单条数据为false 多条数据 true
    addImgStr: '<div style="display: inline-block" id="uploadImg">' +
        '                    <img  class="f-l ml-10" style="width: 50px;height: 50px;" id="imgOperate" src="../../../img/tianjia.png" onclick="pendingExamination.clickUploadImgFn(this)">' +
        '                    <input id="imgs" type="file" accept=".jpg,.jpeg,.png"  style="display: none" onchange="pendingExamination.uploadImgFn()">' +
        '                </div>',//添加图片按钮
    saleAreas:[],//销售区域
    skus:[],//体积、长度、重量修改集合
    init: function () {
        if (getQueryString("skuId")) { // 单条数据审核
            var skuId = getQueryString("skuId");
            this.skuIds.push(skuId);
            this.getBasicInfo([skuId]);
            sessionStorage.removeItem('skuIds');
            this.checkFlag = false;
        } else { // 多条数据
            var skuIds = sessionStorage.getItem('skuIds');
            if (skuIds) {
                this.getBasicInfo(skuIds.split(','));
            }
            this.checkFlag = true;
        }
        this.addClick();
    },
    addClick: function () {
        // 校验信息
        $('#tableForm').Validform({
            tiptype: 2,
            callback:function(){

            }
        })

        // 一级分类的下拉监听事件
        $('#first').on('change', function () {
            var id = $(this).val();
            $('#second').val('');// 清空二级分类
            $('#third').val('');//清空三级分类
            $('#fourth').val('');//清空四级分类
            pendingExamination.renderSecondClassify(id);
        });
        // 二级分类下拉监听事件
        $('#second').on('change', function () {
            var id = $(this).val();
            $('#third').val('');//清空三级分类
            $('#fourth').val('');//清空四级分类
            pendingExamination.renderThirdClassify(id);
        });
        // 三级分类的下拉监听事件
        $('#third').on('change', function () {
            var id = $(this).val();
            $('#fourth').val('');//清空四级分类
            pendingExamination.renderFourthClassify(id)

        });
        // 四级分类的下拉监听事件
        $('#fourth').on('change', function () {
            var fourCategoryId = $(this).val();
            pendingExamination.categoryId = fourCategoryId;
            layer.msg('归类名称发生变化，请选择归类名称!', {offset: 't'})
            pendingExamination.getClassIficationAndRevenueInfo(fourCategoryId)
        })
        // 归类商品的下拉监听事件
        $('#nameClassify').on('change', function () {
            var revenueCode = $(this).find("option:selected").attr('data-revenueCode');
            var classificationId = $(this).find("option:selected").val();
            pendingExamination.classificationId = classificationId;
            pendingExamination.revenueCode = revenueCode;
            $('.revenueCode').html(revenueCode)
        })
        // 审核通过按钮
        $('.button').delegate('.buttonLeft-name', 'click', function () {
            //checkFlag true 多条数据   false 单条数据     modifyFlag  true 修改   false 未修改
            var params = {
                auditStatus: 20,//审核状态 20:审核通过 30:审核驳回
                spuName:pendingExamination.spuName,
                detail:pendingExamination.detail,
                brandId:pendingExamination.brandId,
                definitionBrandName:pendingExamination.definitionBrandName,
                categoryId: pendingExamination.categoryId,
                classificationId: pendingExamination.classificationId,
                revenueCode: pendingExamination.revenueCode,
                operateUserId: JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.user_ID,
                operateUserName: JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.name,
                saleAreas:pendingExamination.saleAreas,
                //skuAuditRecordDtos:pendingExamination.skus
            }

            if (params.spuName.indexOf("  ") >= 0) {
                return  layer.msg('商品名称中不能包含多个连续空格');
            }

            if(pendingExamination.brandFlag == 'selectBrand'){
                var brandSelect = $('#brand-select').val();
                var inputSpuName = $('.inputSpuName').val();//商品名称
                if(!brandSelect){
                    layer.msg('请选择品牌')
                    return false;
                }else{
                    params.brandId = pendingExamination.brandId;
                    params.definitionBrandName = '';
                    if (inputSpuName.indexOf(brandSelect) == -1) {
                        return  layer.msg('商品名称中需包含品牌名');
                    }
                }

            }else if(pendingExamination.brandFlag == 'inputSelect'){
                var brandInput = $('#brand-input').val();
                if(!brandInput){
                    layer.msg('请输入自定义品牌')
                    return false;
                }else{
                    params.definitionBrandName = $('#brand-input').val()
                    var inputSpuName = $('.inputSpuName').val();//商品名称
                    params.brandId = ''
                    if (inputSpuName.indexOf(params.definitionBrandName) == -1) {
                        return  layer.msg('商品名称中需包含品牌名');
                    }
                }
            }else{
                if(pendingExamination.brandId){
                    params.brandId = pendingExamination.brandId;
                    var brandSelect = $('#brand-select').val();
                    var inputSpuName = $('.inputSpuName').val();//商品名称
                    if (inputSpuName.indexOf(brandSelect) == -1) {
                        return  layer.msg('商品名称中需包含品牌名');
                    }
                }else{
                    params.definitionBrandName = $('#brand-select').val()
                    if (params.spuName.indexOf(params.definitionBrandName) == -1) {
                        return  layer.msg('商品名称中需包含品牌名');
                    }
                }
            }

            if(pendingExamination.checkFlag){
                var multifyBody = $('.multipleBody tr');
                if(pendingExamination.modifyFlag){
                    var mulitfySkus = [];
                    $.each(multifyBody,function(index,item){
                        var inputTd = $(item).children();
                        var checkedFlag = inputTd.eq(0).find('input');
                        if($(checkedFlag).is(':checked')){
                            var obj = {
                                maxLength: inputTd.eq(7).find('input').val(),
                                volume:inputTd.eq(8).find('input').val(),
                                weight:inputTd.eq(9).find('input').val(),
                                skuAuditRecordId:inputTd.eq(0).find('input').attr('data-skuId')
                            };
                            mulitfySkus.push(obj)
                        }
                    });
                    if(mulitfySkus.length  <=0){
                        return  layer.msg('请选择要审核的商品');
                    }else{
                        var mulityFlag = false
                        $.each(mulitfySkus,function(index,item){
                            if(!item.maxLength ||!item.volume || !item.weight){
                                mulityFlag = true;
                            }
                        })
                        if(mulityFlag){
                            return layer.msg('请完善商品信息')
                        }else{
                            pendingExamination.skus = mulitfySkus;
                        }
                    }

                }else{
                    var unModifySkus = [];
                    $.each(multifyBody,function(index,item){
                        var inputTd = $(item).children();
                        var checkFlag = inputTd.eq(0).find('input');
                        if($(checkFlag).is(':checked')){
                            var obj = {
                                maxLength:inputTd.eq(7).find('span').text(),
                                volume:inputTd.eq(8).find('span').text(),
                                weight:inputTd.eq(9).find('span').text(),
                                skuAuditRecordId:inputTd.eq(0).find('input').attr('data-skuId')
                            };
                            unModifySkus.push(obj)
                        }
                    });
                    if(unModifySkus.length <=0){
                        return  layer.msg('请选择要审核的商品');
                    }else{
                        pendingExamination.skus = unModifySkus;
                    }
                }
            }else{
                var singleBody = $('.singleBody tr')
                if(pendingExamination.modifyFlag){
                    var singleSku = []
                    $.each(singleBody,function(index,item){
                        var inputTd = $(item).children();
                        var obj = {
                            maxLength:inputTd.eq(7).find('input').val(),
                            volume:inputTd.eq(8).find('input').val(),
                            weight:inputTd.eq(9).find('input').val(),
                            skuAuditRecordId:inputTd.eq(0).find('span').attr('data-skuId')
                        };
                        singleSku.push(obj)
                    });
                    // 体积、长度、重量的校验
                    if(!singleSku[0].maxLength){
                        return layer.msg('请输入最长边')
                    }
                    if(!singleSku[0].volume){
                        return layer.msg('请输入体积')
                    }
                    if(!singleSku[0].weight){
                        return layer.msg('请输入重量')
                    }

                    pendingExamination.skus = singleSku;
                }else{
                    var unSingleSku = [];
                    $.each(singleBody,function(index,item){
                        var inputTd = $(item).children();
                        var obj = {
                            maxLength:inputTd.eq(7).find('span').text(),
                            volume:inputTd.eq(8).find('span').text(),
                            weight:inputTd.eq(9).find('span').text(),
                            skuAuditRecordId:inputTd.eq(0).find('span').attr('data-skuId')
                        };
                        unSingleSku.push(obj)
                    });
                    pendingExamination.skus = unSingleSku;
                }

            }
            // 图片的参数
            var imageLists = $('.item-image');
            var imageAry = [];
            $.each(imageLists,function(index,item){
                var originName = $(item).attr('data-originName');
                var url = $(item).attr('data-url');
                var obj = {
                    attachmentUrl:url,
                    attachmentOriginalName:originName
                };
                imageAry.push(obj);
            });
            params.spuImages = imageAry;
            var imgLength = $('.picture .right').length;
            if(imgLength < 2){
                layer.msg('请最少上传2张图片')
                return false;
            }
            if (pendingExamination.modifyFlag) {
                var firstCategory = $('#first option:selected').val();
                var secondCategory = $('#second option:selected').val();
                var thirdCategory = $('#third option:selected').val();
                var fourthCategory = $('#fourth option:selected').val();
                var nameClassify = $('#nameClassify option:selected').val();
                var inputSpuName = $('.inputSpuName').val();//商品名称
                // 商品名称
                params.spuName = inputSpuName;
                // 详情
                params.detail = UE.getEditor('editor').getContent();//详情
                var imgLength = $('.picture .right').length;
                var detailContent = UE.getEditor('editor').getContent();
                if (!firstCategory || !secondCategory || !thirdCategory || !fourthCategory) {
                    layer.msg('请选择分类')
                    return false;
                } else if (!nameClassify) {
                    layer.msg('请选择归类名称')
                    return false;
                }else if(!inputSpuName){
                    layer.msg('请输入商品名称')
                    return false;
                }else if(!detailContent){
                    layer.msg('请输入详细信息');
                    return false;
                }
                // 商品名称
                params.spuName = $('.inputSpuName').val();
                
                // 选择品牌

                if(pendingExamination.brandFlag == 'selectBrand'){
                    var brandSelect = $('#brand-select').val();
                    if(!brandSelect){
                        layer.msg('请选择品牌')
                        return false;
                    }else{
                        params.brandId = pendingExamination.brandId;
                        params.definitionBrandName = '';
                    }

                }else if(pendingExamination.brandFlag == 'inputSelect'){
                    var brandInput = $('#brand-input').val();
                    if(!brandInput){
                        layer.msg('请输入自定义品牌')
                        return false;
                    }else{
                        params.definitionBrandName = $('#brand-input').val()
                        params.brandId = ''
                    }
                }else{
                    if(pendingExamination.brandId){
                        params.brandId = pendingExamination.brandId;
                    }else{
                        params.definitionBrandName = $('#brand-select').val()
                    }
                }
            }

            // 详情
            params.detail = UE.getEditor('editor').getContent();//详情
            if (params.detail) {
                var detail_img_num = params.detail.split('<img src=').length - 1;
                if (detail_img_num < 2) {
                    layer.msg('详细介绍处需上传2张以上图片')
                    return false;
                }
            }
            
            params.skuAuditRecordDtos = pendingExamination.skus;
            var curIndex = layer.confirm('是否确定审核通过', {
                title: '审核通过',
            }, function () {
                pendingExamination.getBatchAuditInfo(params)
                layer.close(curIndex);
            }, function () {
                layer.close(curIndex);
            })
        });
        // 审核不通过按钮
        $('.button').delegate('.buttonRight-name', 'click', function () {
            if (pendingExamination.checkFlag) {
                // 多个审核集合
                var arySkus = [];
                // 审核多个商品勾选状态
                var checkSkuIds = $('.selectCheck');
                $.each(checkSkuIds, function (index, item) {
                    if ($(item).is(':checked')) {
                        var id = $(item).attr('data-skuId');
                        var obj = {
                            maxLength:'',
                            volume:'',
                            weight:'',
                            skuAuditRecordId:id
                        }
                        arySkus.push(obj)
                    }
                });
                if (arySkus.length > 0) {
                    pendingExamination.skus = arySkus;
                    $('.model').show();
                } else {
                    layer.msg('请选择审核不通过的商品')
                    return false;
                }
            } else {
                var obj = {
                    maxLength:'',
                    volume:'',
                    weight:'',
                    skuAuditRecordId:pendingExamination.skus[0].skuAuditRecordId
                }
                pendingExamination.skus = [obj];
                $('.model').show();
            }

        });
        //审核不通过取消操作
        $('.modelBtn').delegate('.cancel-btn', 'click', function () {
            $('.model').hide();
        })
        // 审核不通过弹窗 -- 确认操作
        $('.modelBtn').delegate('.sure-btn', 'click', function () {
            var reason = $('#reason').val();
            if (!!reason) {
                var rejectParams = {
                    skuAuditRecordDtos: pendingExamination.skus,
                    auditStatus: 30,//审核状态 20:审核通过 30:审核驳回
                    auditFailReason: reason,//驳回原因
                    operateUserId: JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.user_ID,
                    operateUserName: JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.name
                };
                pendingExamination.getBatchAuditInfo(rejectParams)
                $('.model').hide();
            } else {
                layer.msg('请输入审核驳回原因', {time: 1000})
            }
        })
        // 修改操作
        $('#modify').on('click', function () {
            // 取消按钮显示
            $('#cancel-modify').show();
            // 修改按钮隐藏
            $('#modify').hide();
            $('.defaultClassify').hide();
            $('.classificationName').hide();
            $('#thirdClassify').show();
            $('#classifyName').show();
            // 商品名称
            $('.input-brandName').show();
            $('.spuName').hide();
            // 品牌
            $('.select-brand').show();
            $('.brandName').hide();
            // 图片
            $('.delete-btn').show();
            if ($('.picture .right').length < 5) {
                $('#uploadImg').remove();//去掉上传图片logo
                $('.picture').append(pendingExamination.addImgStr);
            }
            pendingExamination.modifyFlag = true; // 修改标识
            if(pendingExamination.singleOrMultipleFlag){
                pendingExamination.tableMultipleLists(pendingExamination.dataSource);
            }else{
                pendingExamination.tableSingleLists(pendingExamination.dataSource);
            }
            // 详情页面
            $('.detail').hide();
            $('.edit-detail').show();


        });
        // 取消修改操作
        $('#cancel-modify').on('click',function(){
            // 修改按钮显示
            $('#modify').show();
            /* pendingExamination.init()*/
            // 取消按钮隐藏
            $('#cancel-modify').hide();
            $('.defaultClassify').show();
            $('.classificationName').show();
            $('#thirdClassify').hide();
            $('#classifyName').hide();
            // 商品名称
            $('.input-brandName').hide();
            $('.spuName').show();
            // 品牌
            $('.select-brand').hide();
            $('.brandName').show();
            $('.delete-btn').hide();
            $('#uploadImg').remove();//去掉上传图片logo
            // 详情页面
            $('.detail').show();
            $('.edit-detail').hide();
            pendingExamination.modifyFlag = false;//修改标识
            if(pendingExamination.singleOrMultipleFlag){
                pendingExamination.tableMultipleLists(pendingExamination.dataSource);
            }else{
                pendingExamination.tableSingleLists(pendingExamination.dataSource);
            }
        })
        // 点击查看大图
        $('.picture').delegate('.right .itemimage', 'click', function () {
            var imgUrl = $(this).attr('src')
            var title = '查看图片'
            var url = '../../goods/picShow.html';
            window.event ? window.event.cancelBubble = true : e.stopPropagation();
            sessionStorage.setItem("imgUrl", imgUrl);
            layer_show(title, url, "800", "500");
        });
        // 品牌搜索
        $('#brand-select').on('keyup', function () {
            var brandName = $('#brand-select').val();
            pendingExamination.delayFn(brandName)
        });
        // 选择品牌的某一项
        $(".brand-lists").delegate('li', 'click', function () {
            var itemLi = $(this).text();
            var brandId = $(this).attr('data-brandId');
            pendingExamination.brandId = brandId;
            $('#brand-select').val(itemLi);
            $(".brand-lists").hide();
            pendingExamination.brandFlag = 'selectBrand';

        });
        // 点击此处添加 - 品牌
        $('.add-brand').on('click', function () {
            $('.input-brand').show();
            $('.select-brand-input').hide();
            $('.exist-brand').show();
            $('.add-brand-warp').hide();
            // 手动输入品牌
            pendingExamination.brandFlag = 'inputSelect';

        });
        // 点击选择已有商品
        $('.exist-brand').unbind().on('click',function(){
            $('.select-brand-input').show();
            $('.input-brand').hide();
            $('.exist-brand').hide();
            $('.add-brand-warp').show();
            // 筛选品牌
            pendingExamination.brandFlag = 'selectBrand';
        })
        // 商品搜索弹窗取消
        $(document).bind('click', function (e) {
            if ($(e.target).closest(".brand-lists").length == 0 && $(e.target).closest(".brand-lists").length == 0) {
                $(".brand-lists").hide();
            }
        });
        // 销售区域
        $('.saleAreaWarp').delegate('li','click',function(){
            var provinceCode = $(this).attr('data-code')
            var str = '';
            $.each(pendingExamination.saleAreas,function(index,item){
                if(provinceCode == item.code){
                    $.each(item.children,function(index,itm){
                        str +='<span>'+itm.name+'、</span>'
                    })
                }
            })
            layer.alert(str,{title:'销售区域',offset:'t'})
        })

        //点选驳回原因
        $(".reason-label").click(function(){
            console.log($(this));
            if ($(this).hasClass("press-down")) {
                $(this).removeClass("press-down");
            } else {
                $(this).addClass("press-down");
            }
            var reason_html = "";
            $(".press-down").each(function(){
                reason_html += $(this).html() + " ";
            })
            $("#reason").val(reason_html);
        })
    },

    // 点击上传图片
    clickUploadImgFn: function () {
        $('#imgs').trigger('click')
    },
    // 上传图片
    uploadImgFn: function () {

        var file = $("#imgs")[0].files[0];
        //初始化FileReader对象
        var reader = new FileReader();
        //读取图片文件
        reader.readAsDataURL(file);
        reader.onload = function (e) {
          //初始化JavaScript图片对象
          var image = new Image();
          //FileReader获得Base64字符串
          image.src = e.target.result;
          image.onload = function () {
            if (this.height != 800) {
                layer.msg('图片尺寸需为800*800');
                return false;
            } else if (this.width != 800) {
                layer.msg('图片尺寸需为800*800');
                return false;
            }else{
                var formData = new FormData();
                formData.set('files', $("#imgs")[0].files[0]);
                pendingExamination.uploadImage(formData)
            }
          }
        }
    },
    // 上传图片接口
    uploadImage: function (formData) {
        $.ajax({
            url: root.serviceProviderManagement.uploadImages,
            cache: false,  //禁用缓存
            type: "POST",
            processData: false,
            contentType: false,
            data: formData,
            success: function (data) {
                var result = data.data;
                var fullPath = result[0].imgUrl;
                var fileName = result[0].imgFileName;
                // 添加删除标识
                var ary = fullPath.split('/');
                var imgFlag = ary[ary.length - 1];
                var flag = imgFlag.split('.');
                var flag2 = "img" + flag[0]
                $('#uploadImg').remove();
                var str = ' <li class="right item-image" data-flag="' + flag2 + '" data-originName="'+fileName+'" data-url="'+fullPath+'?x-oss-process=style/marking_detail">' +
                    '                    <img  style="width: 50px;height: 50px" src="' + fullPath + '?x-oss-process=style/marking_detail' + '" class="mr-10 itemimage" data-name="' + fileName + '" >' +
                    '                    <div style="margin-top:10px;text-align:center;">' +
                    '                        <span style="color: blue;cursor: pointer" onclick="pendingExamination.deleteImage(\'' + flag2 + '\')">删除</span>' +
                    '                    </div>' +
                    '                </li>';
                $('.picture').append(str + pendingExamination.addImgStr);
                if ($('.picture .right').length >= 5) {
                    $('#imgOperate').hide()
                } else {
                    $('#imgOperate').show()
                }
            },
        })
    },
    // 点击删除图片
    deleteImage: function (url) {
        var imageLists = $('.item-image');
        $.each(imageLists, function (index, item) {
            var itemUrl = $(item).attr('data-flag');
            console.log('---------------')
            console.log(itemUrl);
            console.log(url);
            if (itemUrl == url) {
                $(item).remove();
                $('#imgOperate').show();
                if ($('.picture .right').length < 5) {
                    $('#uploadImg').remove();//去掉上传图片logo
                    $('.picture').append(pendingExamination.addImgStr);
                }
            }
        })
    },
    //   获取四级分类
    getClassifyInfo: function (customerId,obj) {
        var params = {
            customerId: customerId,
           // customerId:'CN12345678',
            categoryName:''
        }
        var successData = function (data) {
            if (data.errorCode == 0) {
                if (!!data.data) {
                    var firstCategoryList = data.data.firstCategoryList;
                    pendingExamination.secondCategoryList = data.data.secondCategoryList;
                    pendingExamination.thirdCategoryList = data.data.thirdCategoryList;
                    pendingExamination.fourCategoryList = data.data.categoryList;
                    pendingExamination.renderFirstClassify(firstCategoryList,obj);
                }

            }
        }
        return web.doAjax(root.serviceProviderManagement.selectChannelProductRule, 'post', params, successData, 1)
    },
    // 根据四级分类查询归类商品
    getClassIficationAndRevenueInfo: function (categoryId,obj) {
        var params = {
            categoryId:categoryId
        }
        var successData = function (data) {
            if (data.errorCode == 0) {
                pendingExamination.nameClassify(data.data, obj)
            }
        }
        return web.doAjax(root.serviceProviderManagement.getClassIficationAndRevenueInfo, 'post', params, successData, 1)
    },
    // 渲染归类名称
    nameClassify: function (result,obj) {
        var str = '';
        if (result.length > 0) {
            $.each(result, function (index, item) {
                str += '<option value="' + item.classificationId + '" data-revenueCode="' + item.revenueCode + '">' + item.classificationName + '</option>'
            });
            var newStr = '<option value="" selected>请选择归类名称</option>' + str;
            $('#nameClassify').html(newStr)
        } else {
            var empty = '<option value="" >暂无数据</option>';
            $('#nameClassify').html(empty)
        }
        if(!pendingExamination.modifyFlag){
            $('#nameClassify').val(obj.classificationId);
        }
    },
    // 渲染一级分类
    renderFirstClassify: function (result,obj) {
        /*console.log(pendingExamination.modifyFlag,'切换一级分类')*/
        var str = '';
        $.each(result, function (index, item) {
            str += '<option value="' + item.uuid + '">' + item.categoryName + '</option>'
        });
        var newStr = '<option value="" selected>请选择一级分类</option>' + str;
        $('#first').html(newStr);
        if(!pendingExamination.modifyFlag){
            $('#first').val(obj.oneCategoryId);
            pendingExamination.renderSecondClassify(obj.oneCategoryId,obj);
        }
    },
    // 渲染二级分类
    renderSecondClassify: function (id,obj) {
        var str = '';
        var secondLists = pendingExamination.secondCategoryList.filter(function (item) {
            return id == item.parentUuid
        });
        $.each(secondLists, function (index, item) {
            str += '<option value="' + item.uuid + '">' + item.categoryName + '</option>'
        });
        var newStr = '<option value="" selected>请选择二级分类</option>' + str;
        $('#second').html(newStr);
        if(!pendingExamination.modifyFlag){
            $('#second').val(obj.twoCategoryId);
            pendingExamination.renderThirdClassify(obj.twoCategoryId,obj)
        }
    },
    // 渲染三级分类
    renderThirdClassify: function (id,obj) {
        var str = '';
        var thirdLists = pendingExamination.thirdCategoryList.filter(function (item) {
            return id == item.parentUuid
        });
        $.each(thirdLists, function (index, item) {
            str += '<option value="' + item.uuid + '" data-code="' + item.categoryNo + '">' + item.categoryName + '</option>'
        });
        var newStr = '<option value="" selected>请选择三级分类</option>' + str;
        $('#third').html(newStr);
        if(!pendingExamination.modifyFlag){
            $('#third').val(obj.threeCategoryId);
            pendingExamination.renderFourthClassify(obj.threeCategoryId,obj);
        }
    },
    // 渲染四级分类
    renderFourthClassify: function (id,obj) {
        var str = '';
        var fourthLists = pendingExamination.fourCategoryList.filter(function (item) {
            return id == item.parentUuid
        })

        $.each(fourthLists, function (index, item) {
            str += '<option value="' + item.uuid + '" data-code="' + item.categoryNo + '">' + item.categoryName + '</option>'
        });
        var newStr = '<option value="" selected>请选择四级分类</option>' + str;
        $('#fourth').html(newStr)
        if(!pendingExamination.modifyFlag){
            $('#fourth').val(obj.fourCategoryId);
            pendingExamination.getClassIficationAndRevenueInfo(obj.fourCategoryId,obj);
        }
    },
    // 请求基础信息
    getBasicInfo: function (skuAuditRecordIds) {
        console.log(22222);
        var params = {
            skuAuditRecordIds: skuAuditRecordIds
        }
        var successData = function (data) {
            if (data.errorCode == 0) { //
                /*pendingExamination.renderFirstData(data.data);
                pendingExamination.renderSecondData(data.data);
                pendingExamination.renderFourthData(data.data);
                // 单个审核
                if (result.skus.length <= 1) {
                    pendingExamination.renderSingleListsData(result.skus);
                    $('.singleTable').show();
                    $('.multipleTable').hide();
                } else {
                    pendingExamination.renderMultipleListsData(result.skus);
                    $('.singleTable').hide();
                    $('.multipleTable').show();
                }
                pendingExamination.getClassifyInfo(data.data.channelId)*/
                var result = data.data;
                // 单个审核
                if (result.skus.length <= 1) {
                    pendingExamination.renderSingleListsData(result.skus);
                    $('.singleTable').show();
                    $('.multipleTable').hide();
                    pendingExamination.singleOrMultipleFlag = false;
                } else {
                    pendingExamination.renderMultipleListsData(result.skus);
                    $('.singleTable').hide();
                    $('.multipleTable').show();
                    pendingExamination.singleOrMultipleFlag = true;
                }
                // 一级分类id  二级分类 id 三级分类id
                var oneCategoryId = result.oneCategoryId;
                var twoCategoryId = result.twoCategoryId;
                var threeCategoryId = result.threeCategoryId;
                var fourCategoryId = result.categoryId;
                var classificationId = result.classificationId;//归类名称
                var threeCategoryCode = result.threeCategoryCode;//三级分类的code
                var fourCategoryCode = result.fourCategoryCode;//三级分类的code
                var obj = {
                    oneCategoryId:oneCategoryId,
                    twoCategoryId:twoCategoryId,
                    threeCategoryId:threeCategoryId,
                    fourCategoryId:fourCategoryId,
                    classificationId:classificationId,
                    threeCategoryCode:threeCategoryCode,
                    fourCategoryCode:fourCategoryCode
                }
                pendingExamination.getClassifyInfo(result.channelId,obj);
                pendingExamination.renderFirstData(result);
                pendingExamination.renderSecondData(result);
                pendingExamination.renderFourthData(result);
            }
        }
        return web.doAjax(root.serviceProviderManagement.getAuditProductDetail, 'post', params, successData, 1)
    },
    // 渲染模块一数据
    renderFirstData: function (result) {
        var providerName = result.providerName ? result.providerName : '';
        // var customerName = result.customerName ? result.customerName : '';
        var channelName  = result.channelName  ? result.channelName  : '';
        var updateTime = result.skus[0].updateTime;// 更新时间
        var auditStatus = result.skus[0].auditStatus;// 状态
        if (auditStatus == 10) {
            $('.auditStatus').html('待审核')
        } else if (auditStatus == 20) {
            $('.auditStatus').html('审核通过')
        } else if (auditStatus == 30) {
            $('.auditStatus').html('审核驳回')
        } else {
            $('.auditStatus').html('')
        }
        $('.providerName').html(providerName);
        $('.belongChannel').html(channelName );
        $('.updateTime').html(updateTime);
    },
    // 渲染模块二数据
    renderSecondData: function (result) {
        var spuName = result.spuName ? result.spuName : '';//商品名称
        var oneCategoryName = result.oneCategoryName ? result.oneCategoryName : '';//一级名称
        var twoCategoryName = result.twoCategoryName ? result.twoCategoryName : '';//二级名称
        var threeCategoryName = result.threeCategoryName ? result.threeCategoryName : '';//三级名称
        var fourCategoryName = result.fourCategoryName ? result.fourCategoryName:'';//四级分类
        pendingExamination.categoryId = result.categoryId;// 默认传的分类id
        pendingExamination.classificationId = result.classificationId;//归类id
        pendingExamination.revenueCode = result.revenueCode;//税类编码
        pendingExamination.spuName = result.spuName;//商品名称
        //商品id如果有值就传没有则传自定义名称
        result.brandId?pendingExamination.brandId = result.brandId:pendingExamination.definitionBrandName = result.definitionBrandName
        pendingExamination.detail = result.detail;//详情
        var classificationName = result.classificationName ? result.classificationName : '';//归类名称
        var revenueCode = result.revenueCode ? result.revenueCode : '';//税类编码
        var definitionBrandName = result.definitionBrandName;// 自定义品牌名称
        var brandName = result.brandName ? result.brandName : definitionBrandName;//云采品牌
        var origin = result.origin ? result.origin : '';//产地
        var material = result.material ? result.material : '';//材质
        var restricted = '';//限制类型
        if (result.restricted == 1) {
            restricted = '危化品'
        } else if (result.restricted == 2) {
            restricted = '管制刀具'
        } else {
            restricted = '非限制类'
        }
        var spuImages = result.spuImages; //// 渲染图片
        var productQualifications = result.productQualifications;//商品资质
        // 渲染图片
        if (spuImages.length > 0) {
            var str = '';
            spuImages.forEach(function (item) {
                var flag2 = item.attachmentOriginalName.split('.')[0];
                str += '<li class="right item-image" data-flag="' + flag2 + '" data-originName="'+item.attachmentOriginalName+'" data-url="'+item.attachmentUrl+'">' +
                    '         <img src="' + item.attachmentUrl + '"  style="width: 50px;height: 50px" class=" mr-10 itemimage">' +
                    '             <div style="margin-top:10px;text-align:center;">' +
                    '                   <span style="color: blue; cursor: pointer; display: none" onclick="pendingExamination.deleteImage(' + flag2 + ')" class="delete-btn">删除</span>' +
                    '              </div>' +
                    '       </li>'
            });
            var newStr = '<li class="left">图片：</li>' + str
            $('.picture').html(newStr)
        }

        // 商品资质
        // if (productQualifications) {
        //     $('.product_qualification').show();
        //     $('#downLoadQualification').attr('href', root.orderInter.downLoadFromUrl + '?urlStr=' + productQualifications + '&fileName=下载pdf模板')
        // } else {
        //     $('.product_qualification').hide();
        // }
        if (result.productQualificationAttachments) {
            for (index = 0; index < result.productQualificationAttachments.length; index++) {
                qualificationPDF(result.productQualificationAttachments[index],index);
            }
        }
        var classifyHtml = '<span>' + oneCategoryName + '</span> > <span>' + twoCategoryName + '</span> > <span>' + threeCategoryName + '</span> > <span>' + fourCategoryName + '</span>';
        var saleAreas = result.saleAreas?result.saleAreas:[];
        pendingExamination.saleAreas = saleAreas;
        if(saleAreas.length >0){
            var strArea = '';
            if(saleAreas[0].code == 0){
                $.each(saleAreas,function(index,item){
                    strArea +=' <li style="cursor: pointer;display: inline-block;margin-right: 7px" data-code="'+item.code+'">'+item.name+''+'</li>'
                });
            }else{
                $.each(saleAreas,function(index,item){
                    strArea +=' <li style="cursor: pointer;display: inline-block;margin-right: 7px" data-code="'+item.code+'">'+item.name+'' +
                        ' <span style="color: #0a60d6">('+item.children.length+')</span>' +
                        '</li>'
                });
            }

            $('.saleAreaWarp').html(strArea);
        }
        $('.defaultClassify').html(classifyHtml);
        /* 模块二数据回显 start */
        $('.spuName').html(spuName);
        $('.classificationName').html(classificationName);
        $('.revenueCode').html(revenueCode);
        $('.brandName').html(brandName);
        $('.origin').html(origin);
        $('.material').html(material);
        $('.restricted').html(restricted);
        // 修改数据回显
        $('.inputSpuName').val(spuName);
        //品牌
        $('#brand-select').val(brandName);
    },
    // 渲染模块四数据
    renderFourthData: function (result) {
        $('.detail').html(result.detail);
        if(result.detail){
            ue.ready(function(){
                UE.getEditor('editor').setContent(result.detail, false);
            })
        }
    },
    // 审核单个商品
    renderSingleListsData: function (data) {
        pendingExamination.dataSource = [];
        $.each(data, function (index, item) {
            var obj = {};
            obj.specifications = item.specifications;// 规格
            obj.color = item.color; //颜色
            obj.channelPrice = item.channelPrice;// 售价
            obj.unitName = item.unitName;// 单位
            obj.xfsPurchasePrice = item.xfsPurchasePrice; // 鑫方盛采购价
            obj.deliveryDay = item.deliveryDay; // 预计出货日
            obj.miniOrder = item.miniOrder;// 最小起订量
            obj.maxLength = item.maxLength;//最长边
            obj.volume = item.volume;//体积
            obj.weight = item.weight;//重量
            obj.skuCode = item.skuCode;//skuCode
            obj.lastValidChannelPrice = item.lastValidChannelPrice;//已审核通过的最新信息的售价
            obj.priceChangeWarning = item.priceChangeWarning;//变价超20%
            obj.skuAuditRecordId = item.skuAuditRecordId;//id
            pendingExamination.skus = [
                {
                    maxLength:obj.maxLength,
                    volume:obj.volume,
                    weight:obj.weight,
                    skuAuditRecordId:item.skuAuditRecordId
                }
            ]
            pendingExamination.dataSource.push(obj)
        })
        pendingExamination.tableSingleLists(pendingExamination.dataSource)
    },
    tableSingleLists: function (data) {
        var dataTable = $('#datatable1').dataTable();
        dataTable.fnClearTable();
        dataTable.fnDestroy();
        $("#datatable1").DataTable({
            "order": [[1, "desc"]],
            "autoWidth": false,
            "ordering": false,
            "searching": false,
            "paging": false,
            "retrieve": true,
            "destroy": true,
            "bAutoWidth": true,
            "bLengthChange": true,
            "aLengthMenu": [5, 10, 25, 50],
            "oLanguage": {
                "sLengthMenu": "每页显示 _MENU_ 条记录",
                "sZeroRecords": "抱歉， 没有找到",
                "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                "sInfoEmpty": "",
                "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                }
            },
            data: data,
            columnDefs: [
                {
                    "visible": true,
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var specifications = row.specifications?row.specifications:'';
                        return '<span style="text-align: center;"  data-skuId="'+row.skuAuditRecordId+'">' + specifications + '</span>';
                    },
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var color = row.color?row.color:'';
                        return '<span style="text-align: center;" >' + color + '</span>';

                    },
                    "targets": 1
                },
                {
                    "render": function (data, type, row, meta) {
                        var channelPrice = row.channelPrice?row.channelPrice:0;
                        return '<span style="text-align: center;">¥' + channelPrice.toFixed(2) + '/' + row.unitName+'</span>';
                    },
                    "targets": 2
                },
                {
                    "render": function (data, type, row, meta) {
                        var price_html = "";
                        if (row.skuCode && row.priceChangeWarning) {
                            price_html += "<div class='triangle-box' onmouseover=\"javascript:$('.confirm-box').show();\" onmouseout=\"javascript:$('.confirm-box').hide();\"><div class='confirm-box'>当前售价：¥ " + row.lastValidChannelPrice + "/" + row.unitName + ",变价超20%</div></div>";
                        }
                        return price_html;
                    },
                    "targets": 3
                },
                {
                    "render": function (data, type, row, meta) {
                        var xfsPurchasePrice = row.xfsPurchasePrice?row.xfsPurchasePrice:0;
                        return '<span style="text-align: center;">¥' + xfsPurchasePrice.toFixed(2) + '/' + row.unitName + '</span>';
                    },
                    "targets": 4
                },
                {
                    "render": function (data, type, row, meta) {
                        var deliveryDay = row.deliveryDay?row.deliveryDay:'';
                        return '<span style="text-align: center;">' + deliveryDay + ' 天</span>';
                    },
                    "targets": 5
                },
                // 最小起订量
                {
                    "render": function (data, type, row, meta) {
                        var miniOrder = row.miniOrder?row.miniOrder:'';
                        return '<span style="text-align: center;">' + miniOrder + ""+ row.unitName+ '</span>';
                    },
                    "targets": 6
                },
                // 最长边
                {
                    "render": function (data, type, row, meta) {
                        if(pendingExamination.modifyFlag){
                            return ' <div class="formControls col-sm-8" style="width: 55%">' +
                                '                        <input' +
                                '                                type="text" class="input-text radius maxLong"' +
                                '                                onkeyup="value=value.replace(/[^\\d^\\.]+/g,\'\').replace(\'.\',\'$#$\').replace(/\\./g,\'\').replace(\'$#$\',\'.\')"\n' +
                                '                                placeholder="请输入最长边"' +
                                '                                nullmsg="请输入最长边"' +
                                '                                errormsg="小数点后最多输入6位有效数字"' +
                                '                                number="10"' +
                                '                                maxlength="10"' +
                                '                                datatype="/^[0-9]+(.[0-9]{1,6})?$/"' +
                                '                                value="'+ row.maxLength +'"'+
                                '                        >' +
                                '                        <span style="position: absolute;top: 4px;margin-left: 6px;width: 18px;display: inline-block" >cm</span>' +
                                '                    </div>' +
                                '                    <span class="Validform_checktip">' +
                                '               <span class="Validform_checktip"></span>'+
                                '               </span>'
                        }else{
                            return '<span style="text-align: center;">' + row.maxLength  +'</span>'+'cm';
                        }
                    },
                    "targets": 7
                },
                // 体积
                {
                    "render": function (data, type, row, meta) {

                        if(pendingExamination.modifyFlag){
                            return ' <div class="formControls col-sm-8" style="width: 55%">' +
                                '                        <input' +
                                '                                type="text" class="input-text radius maxLong"' +
                                '                                onkeyup="value=value.replace(/[^\\d^\\.]+/g,\'\').replace(\'.\',\'$#$\').replace(/\\./g,\'\').replace(\'$#$\',\'.\')"\n' +
                                '                                placeholder="请输入体积"' +
                                '                                nullmsg="请输入体积"' +
                                '                                errormsg="小数点后最多输入6位有效数字"' +
                                '                                number="10"' +
                                '                                maxlength="10"' +
                                '                                datatype="/^[0-9]+(.[0-9]{1,6})?$/"' +
                                '                                value="'+ row.volume +'"'+
                                '                        >' +
                                '                        <span style="position: absolute;top: 4px;margin-left: 6px;width: 18px;display: inline-block" >m³</span>' +
                                '                    </div>' +
                                '                    <span class="Validform_checktip">' +
                                '               <span class="Validform_checktip"></span>'+
                                '               </span>'
                        }else{
                            return '<span style="text-align: center;">' + row.volume + '</span>'+'m³';
                        }
                    },
                    "targets": 8
                },
                //重量
                {
                    "render": function (data, type, row, meta) {

                        if(pendingExamination.modifyFlag){
                            return ' <div class="formControls col-sm-8" style="width: 55%">' +
                                '                        <input' +
                                '                                type="text" class="input-text radius maxLong"' +
                                '                                onkeyup="value=value.replace(/[^\\d^\\.]+/g,\'\').replace(\'.\',\'$#$\').replace(/\\./g,\'\').replace(\'$#$\',\'.\')"\n' +
                                '                                placeholder="请输入重量"' +
                                '                                nullmsg="请输入重量"' +
                                '                                errormsg="小数点后最多输入6位有效数字"' +
                                '                                number="10"' +
                                '                                maxlength="10"' +
                                '                                datatype="/^[0-9]+(.[0-9]{1,6})?$/"' +
                                '                                value="'+ row.weight +'"'+
                                '                        >' +
                                '                        <span style="position: absolute;top: 4px;margin-left: 6px;width: 18px;display: inline-block" >kg</span>' +
                                '                    </div>' +
                                '                    <span class="Validform_checktip">' +
                                '               <span class="Validform_checktip"></span>'+
                                '               </span>'
                        }else{
                            return '<span style="text-align: center;">' + row.weight + '</span>'+'kg';
                        }


                    },
                    "targets": 9
                },
            ],
        })
    },
    //  审核多个商品
    renderMultipleListsData: function (data) {
        pendingExamination.dataSource = [];
        $.each(data, function (index, item) {
            var obj = {};
            obj.specifications = item.specifications;// 规格
            obj.color = item.color; //颜色
            obj.channelPrice = item.channelPrice;// 售价
            obj.unitName = item.unitName;// 单位
            obj.xfsPurchasePrice = item.xfsPurchasePrice; // 鑫方盛采购价
            obj.deliveryDay = item.deliveryDay; // 预计出货日
            obj.skuAuditRecordId = item.skuAuditRecordId; // 审核商品id
            obj.miniOrder = item.miniOrder// 最小起订量
            obj.maxLength = item.maxLength;//最长边
            obj.volume = item.volume;//体积
            obj.weight = item.weight;//重量
            obj.skuCode = item.skuCode;//skuCode
            obj.lastValidChannelPrice = item.lastValidChannelPrice;//已审核通过的最新信息的售价
            obj.priceChangeWarning = item.priceChangeWarning;//变价超20%
            obj.skuAuditRecordId = item.skuAuditRecordId;//id
            // sku的参数
            var sku = {
                maxLength:obj.maxLength,
                volume:obj.volume,
                weight:obj.weight,
                skuAuditRecordId:obj.skuAuditRecordId
            }
            pendingExamination.skus.push(sku)
            pendingExamination.dataSource.push(obj)
        })
        pendingExamination.tableMultipleLists(pendingExamination.dataSource)
    },
    tableMultipleLists: function (data) {
        var dataTable = $('#datatable2').dataTable();
        dataTable.fnClearTable();
        dataTable.fnDestroy();
        $("#datatable2").DataTable({
            "order": [[1, "desc"]],
            "autoWidth": false,
            "ordering": false,
            "searching": false,
            "paging": false,
            "retrieve": true,
            "destroy": true,
            "bAutoWidth": true,
            "bLengthChange": true,
            "aLengthMenu": [5, 10, 25, 50],
            "oLanguage": {
                "sLengthMenu": "每页显示 _MENU_ 条记录",
                "sZeroRecords": "抱歉， 没有找到",
                "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                "sInfoEmpty": "",
                "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                }
            },
            data: data,
            columnDefs: [
                {
                    "visible": true,
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var specifications = row.specifications?row.specifications:'';
                        return '<input  class="selectCheck" type="checkbox" name="checkbox" data-skuId="' + row.skuAuditRecordId + '"><span style="text-align: center;margin-left: 10px" >' + specifications + '</span>';
                    },
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var color = row.color?row.color:'';
                        return '<span style="text-align: center;" >' + color + '</span>';
                    },
                    "targets": 1
                },
                {
                    "render": function (data, type, row, meta) {
                        var channelPrice = row.channelPrice;
                        return '<span style="text-align: center;">¥' + channelPrice.toFixed(2) + '/' + row.unitName + '</span>';
                    },
                    "targets": 2
                },
                {
                    "render": function (data, type, row, meta) {
                        var price_html = "";
                        if (row.skuCode && row.priceChangeWarning) {
                            price_html += "<div class='triangle-box' onmouseover=\"javascript:$('.confirm-box').show();\" onmouseout=\"javascript:$('.confirm-box').hide();\"><div class='confirm-box'>当前售价：¥ " + row.lastValidChannelPrice + "/" + row.unitName + ",变价超20%</div></div>";
                        }
                        return price_html;
                    },
                    "targets": 3
                },
                {
                    "render": function (data, type, row, meta) {
                        var xfsPurchasePrice = row.xfsPurchasePrice;
                        return '<span style="text-align: center;">¥' + xfsPurchasePrice.toFixed(2) + '/' + row.unitName + '</span>';
                    },
                    "targets": 4
                },
                {
                    "render": function (data, type, row, meta) {
                        var deliveryDay = row.deliveryDay?row.deliveryDay:'';
                        return '<span style="text-align: center;">' + deliveryDay + '天</span>';
                    },
                    "targets": 5
                },
                // 最小起订量
                {
                    "render": function (data, type, row, meta) {
                        var miniOrder = row.miniOrder?row.miniOrder:'';
                        return '<span style="text-align: center;">' + miniOrder + ""+ row.unitName+ '</span>';
                    },
                    "targets": 6
                },
                // 最长边
                {
                    "render": function (data, type, row, meta) {
                        if(pendingExamination.modifyFlag){
                            return ' <div class="formControls col-sm-8" style="width: 55%">' +
                                '                        <input' +
                                '                                type="text" class="input-text radius maxLong"' +
                                '                                onkeyup="value=value.replace(/[^\\d^\\.]+/g,\'\').replace(\'.\',\'$#$\').replace(/\\./g,\'\').replace(\'$#$\',\'.\')"\n' +
                                '                                placeholder="请输入最长边"' +
                                '                                nullmsg="请输入最长边"' +
                                '                                errormsg="小数点后最多输入6位有效数字"' +
                                '                                number="10"' +
                                '                                maxlength="10"' +
                                '                                datatype="/^[0-9]+(.[0-9]{1,6})?$/"' +
                                '                                value="'+  row.maxLength +'"'+
                                '                        >' +
                                '                        <span style="position: absolute;top: 4px;margin-left: 6px;width: 18px;display: inline-block" >cm</span>' +
                                '                    </div>' +
                                '                    <span class="Validform_checktip">' +
                                '               <span class="Validform_checktip"></span>'+
                                '               </span>'
                        }else{
                            return '<span style="text-align: center;">' +  row.maxLength  +'</span>'+'cm';
                        }
                    },
                    "targets": 7
                },
                // 体积
                {
                    "render": function (data, type, row, meta) {
                        if(pendingExamination.modifyFlag){
                            return ' <div class="formControls col-sm-8" style="width: 55%">' +
                                '                        <input' +
                                '                                type="text" class="input-text radius maxLong"' +
                                '                                onkeyup="value=value.replace(/[^\\d^\\.]+/g,\'\').replace(\'.\',\'$#$\').replace(/\\./g,\'\').replace(\'$#$\',\'.\')"\n' +
                                '                                placeholder="请输入体积"' +
                                '                                nullmsg="请输入体积"' +
                                '                                errormsg="小数点后最多输入6位有效数字"' +
                                '                                number="10"' +
                                '                                maxlength="10"' +
                                '                                datatype="/^[0-9]+(.[0-9]{1,6})?$/"' +
                                '                                value="'+ row.volume +'"'+
                                '                        >' +
                                '                        <span style="position: absolute;top: 4px;margin-left: 6px;width: 18px;display: inline-block" >m³</span>' +
                                '                    </div>' +
                                '                    <span class="Validform_checktip">' +
                                '               <span class="Validform_checktip"></span>'+
                                '               </span>'
                        }else{
                            return '<span style="text-align: center;">' + row.volume + '</span>'+'m³';
                        }

                    },
                    "targets": 8
                },
                //重量
                {
                    "render": function (data, type, row, meta) {
                        if(pendingExamination.modifyFlag){
                            return ' <div class="formControls col-sm-8" style="width: 55%">' +
                                '                        <input' +
                                '                                type="text" class="input-text radius maxLong"' +
                                '                                onkeyup="value=value.replace(/[^\\d^\\.]+/g,\'\').replace(\'.\',\'$#$\').replace(/\\./g,\'\').replace(\'$#$\',\'.\')"\n' +
                                '                                placeholder="请输入重量"' +
                                '                                nullmsg="请输入重量"' +
                                '                                errormsg="小数点后最多输入6位有效数字"' +
                                '                                number="10"' +
                                '                                maxlength="10"' +
                                '                                datatype="/^[0-9]+(.[0-9]{1,6})?$/"' +
                                '                                value="'+ row.weight +'"'+
                                '                        >' +
                                '                        <span style="position: absolute;top: 4px;margin-left: 6px;width: 18px;display: inline-block" >kg</span>' +
                                '                    </div>' +
                                '                    <span class="Validform_checktip">' +
                                '               <span class="Validform_checktip"></span>'+
                                '               </span>'
                        }else{
                            return '<span style="text-align: center;">' + row.weight + '</span>'+'kg';
                        }
                    },
                    "targets": 9
                },
            ],
            fnInitComplete: function () {
                $('#datatable2').on('change', '.selectCheck', function () {
                    var num = $('.tbody').find("input[type=checkbox]:checked").length;
                    var selectTotalLength = $(".selectCheck").length;
                    if (num == selectTotalLength) {
                        $("#selectAll").prop("checked", true)
                    } else {
                        $("#selectAll").prop("checked", false)
                    }
                });
            }
        })
    },
    // 获取审核接口
    getBatchAuditInfo: function (params) {
        var successData = function (data) {
            if (data.errorCode == 0) {
                layer.msg('操作成功')
                window.setTimeout(function () {
                    parent.layer.closeAll();
                }, 2000)
                window.parent.location.reload();

            } else {
                layer.msg(data.msg);
            }
        }

        return web.doAjax(root.serviceProviderManagement.batchAudit, 'post', params, successData, 1)
    },
    // 品牌
    getBrandInfo: function (brandName) {
        var params = {
            brandName: brandName
        }
        var successData = function (data) {
            if (data.errorCode == 0) {
                pendingExamination.renderBrand(data.ListBrand)
            }
        }
        return web.doAjax(root.goodsInter.goods_getListBrand, 'post', params, successData, 2);
    },
    // 渲染品牌
    renderBrand: function (result) {
        if (result && result.length > 0) {
            var str = '';
            result.forEach(function (item) {
                str += '<li class="brand-item" data-brandId="' + item.brandId + '">' + item.brandName + '</li>';
            });
            $('.brand-lists').html(str)
        } else {
            var empty = ' <li class="brand-item">暂无品牌</li>';
            $('.brand-lists').html(empty)
        }
    },
    // 延迟执行搜索
    delayFn: function (value) {
        clearTimeout(pendingExamination.timer);
        pendingExamination.timer = setTimeout(function () {
            pendingExamination.getBrandInfo(value);
            $('.brand-lists').show();
        }, 1000)
    }
}
pendingExamination.init()


//资质pdf渲染
function qualificationPDF(pdf,index)
{
    var qualification_Html = "<div class=\"qualification_module\">";
        qualification_Html += "<img class=\"qualification-img\" src=\"../../../img/Pdf.png\">";
        qualification_Html += "<div class=\"qualification_oper\">";
        qualification_Html += "<a href=\"" + root.orderInter.downLoadFromUrl + "?urlStr="+ pdf.attachmentUrl + "&fileName=下载pdf模板\" class=\"downLoadQualification\">点击下载附件查看</a>";
        qualification_Html += "</div>";
        qualification_Html += "</div>";
        $("#qualification_list").prepend(qualification_Html);
}